package io.wdb.wxapp.model;

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import io.swagger.annotations.ApiModelProperty;

import io.wdb.modules.activity.wxapp.entity.HdCardInitiatorEntity;


/**
 * 抢月卡活动(分享者)
 * 
 * @author wdb
 * @email xulin@wdb007.com
 * @date 2018-01-20 15:11:02
 */
public class HdCardInitiatorModel implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@ApiModelProperty(value = "", required = true)
	private String hdCardInitiatorId;
	@ApiModelProperty(value = "发起时间", required = true)
	private Date initiateTime;
	@ApiModelProperty(value = "获得分数", required = true)
	private Integer totalScore;
	@ApiModelProperty(value = "完成率，4位正整数，客户端/10000（两位小数）", required = true)
	private Integer finishRate;
	@ApiModelProperty(value = "0-进行中，1-已结束", required = true,notes="0-进行中，1-已结束")
	private Integer status;
	@ApiModelProperty(value = "", required = true)
	private String activityId;
	@ApiModelProperty(value = "", required = true)
	private String hdUserId;
	@ApiModelProperty(value = "是否到账(0未到账\1已到账)", required = true)
	private Integer account;

	/**
	 * 设置：
	 */
	public void setHdCardInitiatorId(String hdCardInitiatorId) {
		this.hdCardInitiatorId = hdCardInitiatorId;
	}
	/**
	 * 获取：
	 */
	public String getHdCardInitiatorId() {
		return hdCardInitiatorId;
	}
	/**
	 * 设置：发起时间
	 */
	public void setInitiateTime(Date initiateTime) {
		this.initiateTime = initiateTime;
	}
	/**
	 * 获取：发起时间
	 */
	public Date getInitiateTime() {
		return initiateTime;
	}
	/**
	 * 设置：获得分数
	 */
	public void setTotalScore(Integer totalScore) {
		this.totalScore = totalScore;
	}
	/**
	 * 获取：获得分数
	 */
	public Integer getTotalScore() {
		return totalScore;
	}
	/**
	 * 设置：完成率，4位正整数，客户端/10000（两位小数）
	 */
	public void setFinishRate(Integer finishRate) {
		this.finishRate = finishRate;
	}
	/**
	 * 获取：完成率，4位正整数，客户端/10000（两位小数）
	 */
	public Integer getFinishRate() {
		return finishRate;
	}
	/**
	 * 设置：0-进行中，1-已结束
	 */
	public void setStatus(Integer status) {
		this.status = status;
	}
	/**
	 * 获取：0-进行中，1-已结束
	 */
	public Integer getStatus() {
		return status;
	}
	/**
	 * 设置：
	 */
	public void setActivityId(String activityId) {
		this.activityId = activityId;
	}
	/**
	 * 获取：
	 */
	public String getActivityId() {
		return activityId;
	}
	/**
	 * 设置：
	 */
	public void setHdUserId(String hdUserId) {
		this.hdUserId = hdUserId;
	}
	/**
	 * 获取：
	 */
	public String getHdUserId() {
		return hdUserId;
	}
	/**
	 * 设置：是否到账(0未到账\1已到账)
	 */
	public void setAccount(Integer account) {
		this.account = account;
	}
	/**
	 * 获取：是否到账(0未到账\1已到账)
	 */
	public Integer getAccount() {
		return account;
	}

    public static HdCardInitiatorModel convert(HdCardInitiatorEntity entity) {
		if(entity == null) {
			return null;
		}
		HdCardInitiatorModel model = new HdCardInitiatorModel();
				model.setHdCardInitiatorId(entity.getId());
				model.setInitiateTime(entity.getInitiateTime());
				model.setTotalScore(entity.getTotalScore());
				if(entity.getFinishRate() != null) {
					model.setFinishRate(entity.getFinishRate() >= 10000 ? 10000:entity.getFinishRate());
				}
				model.setStatus(entity.getStatus());
				model.setActivityId(entity.getActivityId());
				model.setHdUserId(entity.getUserId());
				model.setAccount(entity.getAccount());
				
		return model;
	}
	public static List<HdCardInitiatorModel> convert(List<HdCardInitiatorEntity> entities){
		if(entities == null || entities.isEmpty()) {
			return null;
		}
		List<HdCardInitiatorModel> models = new ArrayList<>();
		
		for(HdCardInitiatorEntity entity:entities) {
			models.add(convert(entity));
		}
		
		return models;
	}
	
	public static HdCardInitiatorEntity convert(HdCardInitiatorModel model) {
		if(model == null) {
			return null;
		}
		HdCardInitiatorEntity entity = new HdCardInitiatorEntity();
				entity.setId(model.getHdCardInitiatorId());
				entity.setInitiateTime(model.getInitiateTime());
				entity.setTotalScore(model.getTotalScore());
				entity.setFinishRate(model.getFinishRate());
				entity.setStatus(model.getStatus());
				entity.setActivityId(model.getActivityId());
				entity.setUserId(model.getHdUserId());
				entity.setAccount(model.getAccount());
				
		return entity;
	}

}
